<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../jquery/jquery-3.6.0.min.js"></script>
    <title>Document</title>
    <style>
        div{
            margin: auto;
            margin-top: 20%;
        }
    </style>
</head>
<body>
    <div style="width: 150px; height: 150px; background-color: #000;" ></div>
</body>
<script>
    var i = 1
    $('div').click(function(){
        if(i==1){
            $('body').css('background','#000')
            $('div').css('background','#fff')
            i++
        }else if(i!=1){
            $('body').css('background','#fff')
            $('div').css('background','#000')
            i = 1
        }
    })
    
</script>
</html>